//
//  IGCommunityListApi.m
//  jingdongfang
//
//  Created by BOE on 2017/9/5.
//  Copyright © 2017年 LJL. All rights reserved.
//

#import "IGCommunityListApi.h"

@interface IGCommunityListApi()

@property (nonatomic, assign) IGCommunityListType type;

@end

@implementation IGCommunityListApi

- (id)initWithType:(IGCommunityListType)type lastTimeDate:(NSString *)lastTimeDate page:(NSInteger)page {
    self = [super init];
    if (self) {
        _type = type;
        _lastTimeDate = lastTimeDate;
        _page = page;
    }
    return self;
}

- (NSString *)requestUrl {
    return [self getUrlWithType];
}

- (id)requestArgument {
    return @{
             @"lastTimeDate": _lastTimeDate,
             @"uid":[IGUser getUid],
             @"pageNum":[NSString stringWithFormat:@"%@", @(_page)]
             };
}

- (NSInteger)cacheTimeInSeconds {
    if (self.type == IGCommunityListTypeMeFollow) {
        return -1;
    }
    return 30;
}

#pragma mark -private
- (NSString *)getUrlWithType {
    if (self.type == IGCommunityListTypeAll || self.type == IGCommunityListType4TopicPub) {
        return @"circle/findCircleList";
    } else if (self.type == IGCommunityListTypeMeFollow) {
        return @"circle/findFocusCircles";
    }
    return @"";
}

@end

@implementation IGCommunityListModel

+ (BOOL)propertyIsOptional:(NSString *)propertyName {
    return YES;
}
    
@end

@implementation IGCommunityListResp

@end
